package sueca2011;

import java.io.File;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;
import javax.swing.ImageIcon;
import javax.swing.JButton;

/**
 *
 * @author gabrieloliveira
 */
public class TelaJogo extends javax.swing.JFrame implements Observer{
    private Jogo jogo;
    private Jogador jogador;
    private ArrayList<Carta> cartas;
    private String imgFolder;
    private int i = 0, j = 0, k = 0;

    /** Creates new form TelaJogo */
    public TelaJogo(Jogo jogo, Jogador jogador) {
        jogo.addObserverNasRodadas(this);
        imgFolder = new File("img").getAbsolutePath()+File.separator;
        //imgFolder = this.getClass().getResource("img").toString()+File.separator;
        //imgFolder = imgFolder.substring(imgFolder.indexOf(":")+1, imgFolder.length());
        System.out.println(imgFolder);
        this.jogo = jogo;
        this.jogador = jogador;
        this.cartas = this.jogador.getCartasIniciais();
        initComponents();
        jogada1.setVisible(false);
        jogada2.setVisible(false);
        jogada3.setVisible(false);
        jogada4.setVisible(false);
        nomeDonoTrunfo.setText(jogo.getDonoTrunfo().getNome());
        jButton1.setVisible(false);
        vez.setText("");
        vez1.setText("");
        jLabel1.setVisible(false);
        jLabel2.setVisible(false);

        //cartas dos rivais
        carta31.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta32.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta33.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta34.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta35.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta36.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta37.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta38.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta39.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta40.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        
        carta21.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta22.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta23.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta24.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta25.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta26.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta27.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta28.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta29.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        carta30.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2-rotated.png"));
        
        //cartas do parceiro
        carta11.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta12.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta13.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta14.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta15.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta16.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta17.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta18.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta19.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
        carta20.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        cartaTrunfo = new JButton(new ImageIcon(imgFolder+jogo.getTrunfo().imageURL()));
        ;
        jLayeredPane1 = new javax.swing.JLayeredPane();
        carta10 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(9).imageURL()));
        ;
        carta9 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(8).imageURL()));
        ;
        carta8 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(7).imageURL()));
        ;
        carta7 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(6).imageURL()));
        ;
        carta6 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(5).imageURL()));
        ;
        carta5 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(4).imageURL()));
        ;
        carta4 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(3).imageURL()));
        ;
        carta3 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(2).imageURL()));
        ;
        carta2 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(1).imageURL()));
        ;
        carta1 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(0).imageURL()));
        ;
        jLayeredPane2 = new javax.swing.JLayeredPane();
        jogada1 = new JButton();
        ;
        jogada2 = new JButton();
        ;
        jogada3 = new JButton();
        ;
        jogada4 = new JButton();
        ;
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        nomeDonoTrunfo = new javax.swing.JLabel();
        jLayeredPane3 = new javax.swing.JLayeredPane();
        carta11 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(9).imageURL()));
        ;
        carta12 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(8).imageURL()));
        ;
        carta13 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(7).imageURL()));
        ;
        carta14 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(6).imageURL()));
        ;
        carta15 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(5).imageURL()));
        ;
        carta16 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(4).imageURL()));
        ;
        carta17 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(3).imageURL()));
        ;
        carta18 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(2).imageURL()));
        ;
        carta19 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(1).imageURL()));
        ;
        carta20 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(0).imageURL()));
        ;
        jLayeredPane4 = new javax.swing.JLayeredPane();
        start = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jLayeredPane5 = new javax.swing.JLayeredPane();
        carta21 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(9).imageURL()));
        ;
        carta22 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(8).imageURL()));
        ;
        carta23 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(7).imageURL()));
        ;
        carta24 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(6).imageURL()));
        ;
        carta25 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(5).imageURL()));
        ;
        carta26 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(4).imageURL()));
        ;
        carta27 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(3).imageURL()));
        ;
        carta28 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(2).imageURL()));
        ;
        carta29 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(1).imageURL()));
        ;
        carta30 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(0).imageURL()));
        ;
        jLayeredPane6 = new javax.swing.JLayeredPane();
        carta31 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(9).imageURL()));
        ;
        carta32 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(8).imageURL()));
        ;
        carta33 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(7).imageURL()));
        ;
        carta34 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(6).imageURL()));
        ;
        carta35 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(5).imageURL()));
        ;
        carta36 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(4).imageURL()));
        ;
        carta37 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(3).imageURL()));
        ;
        carta38 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(2).imageURL()));
        ;
        carta39 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(1).imageURL()));
        ;
        carta40 = new JButton(new ImageIcon(imgFolder+jogador.getCartasIniciais().get(0).imageURL()));
        ;
        vez = new javax.swing.JLabel();
        vez1 = new javax.swing.JLabel();

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sueca2011.JogoApp.class).getContext().getResourceMap(TelaJogo.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setBackground(resourceMap.getColor("Form.background")); // NOI18N
        setName("Form"); // NOI18N

        cartaTrunfo.setName("cartaTrunfo"); // NOI18N
        cartaTrunfo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cartaTrunfoActionPerformed(evt);
            }
        });

        jLayeredPane1.setBackground(resourceMap.getColor("jLayeredPane1.background")); // NOI18N
        jLayeredPane1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, jogo.getTimeA().getJogador1().getNome(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Grande", 0, 13), resourceMap.getColor("jLayeredPane1.border.titleColor"))); // NOI18N
        jLayeredPane1.setName("jLayeredPane1"); // NOI18N

        carta10.setName("carta10"); // NOI18N
        carta10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta10ActionPerformed(evt);
            }
        });
        carta10.setBounds(200, 20, 75, 107);
        jLayeredPane1.add(carta10, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta9.setName("carta9"); // NOI18N
        carta9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta9ActionPerformed(evt);
            }
        });
        carta9.setBounds(180, 20, 75, 107);
        jLayeredPane1.add(carta9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta8.setName("carta8"); // NOI18N
        carta8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta8ActionPerformed(evt);
            }
        });
        carta8.setBounds(160, 20, 75, 107);
        jLayeredPane1.add(carta8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta7.setName("carta7"); // NOI18N
        carta7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta7ActionPerformed(evt);
            }
        });
        carta7.setBounds(140, 20, 75, 107);
        jLayeredPane1.add(carta7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta6.setName("carta6"); // NOI18N
        carta6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta6ActionPerformed(evt);
            }
        });
        carta6.setBounds(120, 20, 75, 107);
        jLayeredPane1.add(carta6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta5.setName("carta5"); // NOI18N
        carta5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta5ActionPerformed(evt);
            }
        });
        carta5.setBounds(100, 20, 75, 107);
        jLayeredPane1.add(carta5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta4.setName("carta4"); // NOI18N
        carta4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta4ActionPerformed(evt);
            }
        });
        carta4.setBounds(80, 20, 75, 107);
        jLayeredPane1.add(carta4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta3.setName("carta3"); // NOI18N
        carta3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta3ActionPerformed(evt);
            }
        });
        carta3.setBounds(60, 20, 75, 107);
        jLayeredPane1.add(carta3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta2.setName("carta2"); // NOI18N
        carta2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta2ActionPerformed(evt);
            }
        });
        carta2.setBounds(40, 20, 75, 107);
        jLayeredPane1.add(carta2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta1.setName("carta1"); // NOI18N
        carta1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta1ActionPerformed(evt);
            }
        });
        carta1.setBounds(20, 20, 75, 107);
        jLayeredPane1.add(carta1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("jLayeredPane2.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Grande", 0, 13), resourceMap.getColor("jLayeredPane2.border.titleColor"))); // NOI18N
        jLayeredPane2.setName("jLayeredPane2"); // NOI18N

        jogada1.setName("jogada1"); // NOI18N
        jogada1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jogada1ActionPerformed(evt);
            }
        });
        jogada1.setBounds(150, 310, 75, 107);
        jLayeredPane2.add(jogada1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jogada2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jogada2ActionPerformed1(evt);
            }
        });
        jogada2.setBounds(150, 40, 75, 107);
        jLayeredPane2.add(jogada2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jogada3.setName("jogada3"); // NOI18N
        jogada3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jogada3ActionPerformed(evt);
            }
        });
        jogada3.setBounds(20, 190, 75, 107);
        jLayeredPane2.add(jogada3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jogada4.setName("jogada4"); // NOI18N
        jogada4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jogada4ActionPerformed(evt);
            }
        });
        jogada4.setBounds(270, 180, 75, 107);
        jLayeredPane2.add(jogada4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setIcon(resourceMap.getIcon("jLabel2.icon")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
        jLabel2.setBounds(-360, -20, 1140, 600);
        jLayeredPane2.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setIcon(resourceMap.getIcon("jLabel1.icon")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
        jLabel1.setBounds(-640, -20, 1140, 600);
        jLayeredPane2.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        nomeDonoTrunfo.setForeground(resourceMap.getColor("nomeDonoTrunfo.foreground")); // NOI18N
        nomeDonoTrunfo.setText(resourceMap.getString("nomeDonoTrunfo.text")); // NOI18N
        nomeDonoTrunfo.setName("nomeDonoTrunfo"); // NOI18N

        jLayeredPane3.setBackground(resourceMap.getColor("jLayeredPane3.background")); // NOI18N
        jLayeredPane3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, jogo.getTimeA().getJogador2().getNome(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Grande", 0, 13), resourceMap.getColor("jLayeredPane3.border.titleColor"))); // NOI18N
        jLayeredPane3.setName("jLayeredPane3"); // NOI18N

        carta11.setName("carta11"); // NOI18N
        carta11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta11ActionPerformed(evt);
            }
        });
        carta11.setBounds(200, 20, 75, 107);
        jLayeredPane3.add(carta11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta12.setName("carta12"); // NOI18N
        carta12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta12ActionPerformed(evt);
            }
        });
        carta12.setBounds(180, 20, 75, 107);
        jLayeredPane3.add(carta12, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta13.setName("carta13"); // NOI18N
        carta13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta13ActionPerformed(evt);
            }
        });
        carta13.setBounds(160, 20, 75, 107);
        jLayeredPane3.add(carta13, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta14.setName("carta14"); // NOI18N
        carta14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta14ActionPerformed(evt);
            }
        });
        carta14.setBounds(140, 20, 75, 107);
        jLayeredPane3.add(carta14, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta15.setName("carta15"); // NOI18N
        carta15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta15ActionPerformed(evt);
            }
        });
        carta15.setBounds(120, 20, 75, 107);
        jLayeredPane3.add(carta15, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta16.setName("carta16"); // NOI18N
        carta16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta16ActionPerformed(evt);
            }
        });
        carta16.setBounds(100, 20, 75, 107);
        jLayeredPane3.add(carta16, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta17.setName("carta17"); // NOI18N
        carta17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta17ActionPerformed(evt);
            }
        });
        carta17.setBounds(80, 20, 75, 107);
        jLayeredPane3.add(carta17, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta18.setName("carta18"); // NOI18N
        carta18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta18ActionPerformed(evt);
            }
        });
        carta18.setBounds(60, 20, 75, 107);
        jLayeredPane3.add(carta18, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta19.setName("carta19"); // NOI18N
        carta19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta19ActionPerformed(evt);
            }
        });
        carta19.setBounds(40, 20, 75, 107);
        jLayeredPane3.add(carta19, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta20.setName("carta20"); // NOI18N
        carta20.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta20ActionPerformed(evt);
            }
        });
        carta20.setBounds(20, 20, 75, 107);
        jLayeredPane3.add(carta20, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane4.setName("jLayeredPane4"); // NOI18N

        start.setText(resourceMap.getString("start.text")); // NOI18N
        start.setName("start"); // NOI18N
        start.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startActionPerformed(evt);
            }
        });
        start.setBounds(0, 0, 83, 29);
        jLayeredPane4.add(start, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jButton1.setBounds(20, 0, 126, 29);
        jLayeredPane4.add(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane5.setBackground(resourceMap.getColor("jLayeredPane5.background")); // NOI18N
        jLayeredPane5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, jogo.getTimeB().getJogador1().getNome(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Grande", 0, 13), resourceMap.getColor("jLayeredPane5.border.titleColor"))); // NOI18N
        jLayeredPane5.setName("jLayeredPane5"); // NOI18N

        carta21.setName("carta21"); // NOI18N
        carta21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta21ActionPerformed(evt);
            }
        });
        carta21.setBounds(10, 200, 108, 75);
        jLayeredPane5.add(carta21, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta22.setName("carta22"); // NOI18N
        carta22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta22ActionPerformed(evt);
            }
        });
        carta22.setBounds(10, 180, 108, 75);
        jLayeredPane5.add(carta22, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta23.setName("carta23"); // NOI18N
        carta23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta23ActionPerformed(evt);
            }
        });
        carta23.setBounds(10, 160, 108, 75);
        jLayeredPane5.add(carta23, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta24.setName("carta24"); // NOI18N
        carta24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta24ActionPerformed(evt);
            }
        });
        carta24.setBounds(10, 140, 108, 75);
        jLayeredPane5.add(carta24, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta25.setName("carta25"); // NOI18N
        carta25.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta25ActionPerformed(evt);
            }
        });
        carta25.setBounds(10, 120, 108, 75);
        jLayeredPane5.add(carta25, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta26.setName("carta26"); // NOI18N
        carta26.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta26ActionPerformed(evt);
            }
        });
        carta26.setBounds(10, 100, 108, 75);
        jLayeredPane5.add(carta26, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta27.setName("carta27"); // NOI18N
        carta27.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta27ActionPerformed(evt);
            }
        });
        carta27.setBounds(10, 80, 108, 75);
        jLayeredPane5.add(carta27, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta28.setName("carta28"); // NOI18N
        carta28.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta28ActionPerformed(evt);
            }
        });
        carta28.setBounds(10, 60, 108, 75);
        jLayeredPane5.add(carta28, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta29.setName("carta29"); // NOI18N
        carta29.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta29ActionPerformed(evt);
            }
        });
        carta29.setBounds(10, 40, 108, 75);
        jLayeredPane5.add(carta29, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta30.setName("carta30"); // NOI18N
        carta30.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta30ActionPerformed(evt);
            }
        });
        carta30.setBounds(10, 20, 108, 75);
        jLayeredPane5.add(carta30, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane6.setBackground(resourceMap.getColor("jLayeredPane6.background")); // NOI18N
        jLayeredPane6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, jogo.getTimeB().getJogador2().getNome(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Grande", 0, 13), resourceMap.getColor("jLayeredPane6.border.titleColor"))); // NOI18N
        jLayeredPane6.setName("jLayeredPane6"); // NOI18N

        carta31.setName("carta31"); // NOI18N
        carta31.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta31ActionPerformed(evt);
            }
        });
        carta31.setBounds(10, 200, 108, 75);
        jLayeredPane6.add(carta31, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta32.setName("carta32"); // NOI18N
        carta32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta32ActionPerformed(evt);
            }
        });
        carta32.setBounds(10, 180, 108, 75);
        jLayeredPane6.add(carta32, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta33.setName("carta33"); // NOI18N
        carta33.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta33ActionPerformed(evt);
            }
        });
        carta33.setBounds(10, 160, 108, 75);
        jLayeredPane6.add(carta33, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta34.setName("carta34"); // NOI18N
        carta34.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta34ActionPerformed(evt);
            }
        });
        carta34.setBounds(10, 140, 108, 75);
        jLayeredPane6.add(carta34, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta35.setName("carta35"); // NOI18N
        carta35.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta35ActionPerformed(evt);
            }
        });
        carta35.setBounds(10, 120, 108, 75);
        jLayeredPane6.add(carta35, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta36.setName("carta36"); // NOI18N
        carta36.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta36ActionPerformed(evt);
            }
        });
        carta36.setBounds(10, 100, 108, 75);
        jLayeredPane6.add(carta36, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta37.setName("carta37"); // NOI18N
        carta37.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta37ActionPerformed(evt);
            }
        });
        carta37.setBounds(10, 80, 108, 75);
        jLayeredPane6.add(carta37, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta38.setName("carta38"); // NOI18N
        carta38.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta38ActionPerformed(evt);
            }
        });
        carta38.setBounds(10, 60, 108, 75);
        jLayeredPane6.add(carta38, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta39.setName("carta39"); // NOI18N
        carta39.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta39ActionPerformed(evt);
            }
        });
        carta39.setBounds(10, 40, 108, 75);
        jLayeredPane6.add(carta39, javax.swing.JLayeredPane.DEFAULT_LAYER);

        carta40.setName("carta40"); // NOI18N
        carta40.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                carta40ActionPerformed(evt);
            }
        });
        carta40.setBounds(10, 20, 108, 75);
        jLayeredPane6.add(carta40, javax.swing.JLayeredPane.DEFAULT_LAYER);

        vez.setForeground(resourceMap.getColor("vez.foreground")); // NOI18N
        vez.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        vez.setText(resourceMap.getString("vez.text")); // NOI18N
        vez.setName("vez"); // NOI18N

        vez1.setForeground(resourceMap.getColor("vez1.foreground")); // NOI18N
        vez1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        vez1.setText(resourceMap.getString("vez1.text")); // NOI18N
        vez1.setName("vez1"); // NOI18N

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jLayeredPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 144, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .add(25, 25, 25)
                        .add(jLayeredPane5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 128, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(27, 27, 27)
                        .add(jLayeredPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 291, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(vez1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 223, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(vez, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 223, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(layout.createSequentialGroup()
                        .add(jLayeredPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 382, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(jLayeredPane6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 127, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .add(24, 24, 24)
                        .add(jLayeredPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 304, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(26, 26, 26)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(cartaTrunfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(layout.createSequentialGroup()
                                .add(14, 14, 14)
                                .add(nomeDonoTrunfo)))))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(263, 263, 263)
                        .add(jLayeredPane5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 280, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(39, 39, 39)
                        .add(jLayeredPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLayeredPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 135, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(layout.createSequentialGroup()
                                .add(vez)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(vez1)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(jLayeredPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 452, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
                            .add(layout.createSequentialGroup()
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 117, Short.MAX_VALUE)
                                .add(jLayeredPane6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 281, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(54, 54, 54)))
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jLayeredPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 140, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(layout.createSequentialGroup()
                                .add(nomeDonoTrunfo)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(cartaTrunfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 107, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
        );

        jLayeredPane1.getAccessibleContext().setAccessibleName(resourceMap.getString("jLayeredPane1.AccessibleContext.accessibleName")); // NOI18N
        jLayeredPane3.getAccessibleContext().setAccessibleName(resourceMap.getString("jLayeredPane3.AccessibleContext.accessibleName")); // NOI18N

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void carta1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta1ActionPerformed
        this.jogador.escolheJogada(cartas.get(0));
        vez.setText("");
    }//GEN-LAST:event_carta1ActionPerformed

    private void carta2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta2ActionPerformed
        this.jogador.escolheJogada(cartas.get(1));
        vez.setText("");
    }//GEN-LAST:event_carta2ActionPerformed

    private void carta3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta3ActionPerformed
        this.jogador.escolheJogada(cartas.get(2));
        vez.setText("");
    }//GEN-LAST:event_carta3ActionPerformed

    private void carta4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta4ActionPerformed
        this.jogador.escolheJogada(cartas.get(3));
        vez.setText("");
    }//GEN-LAST:event_carta4ActionPerformed

    private void cartaTrunfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cartaTrunfoActionPerformed

    }//GEN-LAST:event_cartaTrunfoActionPerformed

    private void carta6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta6ActionPerformed
        this.jogador.escolheJogada(cartas.get(5));
        vez.setText("");
    }//GEN-LAST:event_carta6ActionPerformed

    private void carta7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta7ActionPerformed
        this.jogador.escolheJogada(cartas.get(6));
        vez.setText("");
    }//GEN-LAST:event_carta7ActionPerformed

    private void carta8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta8ActionPerformed
        this.jogador.escolheJogada(cartas.get(7));
        vez.setText("");
    }//GEN-LAST:event_carta8ActionPerformed

    private void carta9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta9ActionPerformed
        this.jogador.escolheJogada(cartas.get(8));
        vez.setText("");
    }//GEN-LAST:event_carta9ActionPerformed

    private void carta10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta10ActionPerformed
        this.jogador.escolheJogada(cartas.get(9));
        vez.setText("");
    }//GEN-LAST:event_carta10ActionPerformed

    private void startActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startActionPerformed
        jogo.iniciar();
        this.start.setVisible(false);
        this.cartaTrunfo.setVisible(false);
        this.nomeDonoTrunfo.setText("TRUNFO: "+jogo.getTrunfo().nipeToString(jogo.getTrunfo().getNipe()));
    }//GEN-LAST:event_startActionPerformed

    private void carta5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta5ActionPerformed
        this.jogador.escolheJogada(cartas.get(4));
    }//GEN-LAST:event_carta5ActionPerformed

    private void jogada1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jogada1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jogada1ActionPerformed

    private void jogada2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jogada2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jogada2ActionPerformed

    private void jogada3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jogada3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jogada3ActionPerformed

    private void jogada4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jogada4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jogada4ActionPerformed

    private void jogada2ActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jogada2ActionPerformed1
        // TODO add your handling code here:
    }//GEN-LAST:event_jogada2ActionPerformed1

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        this.setVisible(false);
        Jogador jogadorA1 = new Humano(jogo.getTimeA().getJogador1().getNome());
        Jogador jogadorA2,jogadorB1, jogadorB2;

        if (jogo.getTimeA().getJogador2() instanceof Nivel0 ){
            jogadorA2 = new Nivel0("JA2");
            jogadorB1 = new Nivel0("JB1");
            jogadorB2 = new Nivel0("JB2");
        }
        else if(jogo.getTimeA().getJogador2() instanceof Nivel1 ){
            jogadorA2 = new Nivel1("JA2");
            jogadorB1 = new Nivel1("JB1");
            jogadorB2 = new Nivel1("JB2");
        }else{
            jogadorA2 = new Nivel2("JA2");
            jogadorB1 = new Nivel2("JB1");
            jogadorB2 = new Nivel2("JB2");
        }
        Time timeA = new Time(jogadorA1, jogadorA2);
        Time timeB = new Time(jogadorB1, jogadorB2);
        jogo = new Jogo(timeA, timeB);
        new TelaJogo(jogo, jogadorA1).setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void carta11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta11ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta11ActionPerformed

    private void carta12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta12ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta12ActionPerformed

    private void carta13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta13ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta13ActionPerformed

    private void carta14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta14ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta14ActionPerformed

    private void carta15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta15ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta15ActionPerformed

    private void carta16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta16ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta16ActionPerformed

    private void carta17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta17ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta17ActionPerformed

    private void carta18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta18ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta18ActionPerformed

    private void carta19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta19ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta19ActionPerformed

    private void carta20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta20ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta20ActionPerformed

    private void carta21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta21ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta21ActionPerformed

    private void carta22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta22ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta22ActionPerformed

    private void carta23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta23ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta23ActionPerformed

    private void carta24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta24ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta24ActionPerformed

    private void carta25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta25ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta25ActionPerformed

    private void carta26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta26ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta26ActionPerformed

    private void carta27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta27ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta27ActionPerformed

    private void carta28ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta28ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta28ActionPerformed

    private void carta29ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta29ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta29ActionPerformed

    private void carta30ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta30ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta30ActionPerformed

    private void carta31ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta31ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta31ActionPerformed

    private void carta32ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta32ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta32ActionPerformed

    private void carta33ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta33ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta33ActionPerformed

    private void carta34ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta34ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta34ActionPerformed

    private void carta35ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta35ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta35ActionPerformed

    private void carta36ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta36ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta36ActionPerformed

    private void carta37ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta37ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta37ActionPerformed

    private void carta38ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta38ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta38ActionPerformed

    private void carta39ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta39ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta39ActionPerformed

    private void carta40ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_carta40ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_carta40ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaJogo(null,null).setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton carta1;
    private javax.swing.JButton carta10;
    private javax.swing.JButton carta11;
    private javax.swing.JButton carta12;
    private javax.swing.JButton carta13;
    private javax.swing.JButton carta14;
    private javax.swing.JButton carta15;
    private javax.swing.JButton carta16;
    private javax.swing.JButton carta17;
    private javax.swing.JButton carta18;
    private javax.swing.JButton carta19;
    private javax.swing.JButton carta2;
    private javax.swing.JButton carta20;
    private javax.swing.JButton carta21;
    private javax.swing.JButton carta22;
    private javax.swing.JButton carta23;
    private javax.swing.JButton carta24;
    private javax.swing.JButton carta25;
    private javax.swing.JButton carta26;
    private javax.swing.JButton carta27;
    private javax.swing.JButton carta28;
    private javax.swing.JButton carta29;
    private javax.swing.JButton carta3;
    private javax.swing.JButton carta30;
    private javax.swing.JButton carta31;
    private javax.swing.JButton carta32;
    private javax.swing.JButton carta33;
    private javax.swing.JButton carta34;
    private javax.swing.JButton carta35;
    private javax.swing.JButton carta36;
    private javax.swing.JButton carta37;
    private javax.swing.JButton carta38;
    private javax.swing.JButton carta39;
    private javax.swing.JButton carta4;
    private javax.swing.JButton carta40;
    private javax.swing.JButton carta5;
    private javax.swing.JButton carta6;
    private javax.swing.JButton carta7;
    private javax.swing.JButton carta8;
    private javax.swing.JButton carta9;
    private javax.swing.JButton cartaTrunfo;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane2;
    private javax.swing.JLayeredPane jLayeredPane3;
    private javax.swing.JLayeredPane jLayeredPane4;
    private javax.swing.JLayeredPane jLayeredPane5;
    private javax.swing.JLayeredPane jLayeredPane6;
    private javax.swing.JButton jogada1;
    private javax.swing.JButton jogada2;
    private javax.swing.JButton jogada3;
    private javax.swing.JButton jogada4;
    private javax.swing.JLabel nomeDonoTrunfo;
    private javax.swing.JButton start;
    private javax.swing.JLabel vez;
    private javax.swing.JLabel vez1;
    // End of variables declaration//GEN-END:variables

    private int countRodada=0;
    public void update(Observable o, Object o1) {
        Jogador jogador;
        if(o1 instanceof AlertaVencedor){
            jogador = ((AlertaVencedor)o1).getVencedor();
            vez.setText("O jogador "+jogador.getNome()+" venceu!");
            countRodada++;

        } else if(o1 instanceof InicioRodada) {
            jogo.getRodadaAtual().addObserver(this);
            jogada1.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
            jogada2.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
            jogada2.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
            jogada3.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
            jogada4.setIcon(new ImageIcon(this.imgFolder+"back-blue-75-2.png"));
            jogada1.setVisible(true);
            jogada2.setVisible(true);
            jogada3.setVisible(true);
            jogada4.setVisible(true);
            
        }else if(o instanceof Rodada && o1 instanceof AlertaVez){
            jogador = ((AlertaVez)o1).getJogador();
            if(jogador==this.jogador){
                System.out.println("Sua vez!");
                vez.setText("Sua vez, "+jogador.getNome()+"!");
            }else{
                vez.setText("Aguarde sua vez!");
            }
        }else if(o1 instanceof AlertaJogada){
            jogador = ((AlertaJogada)o1).getJogada().getJogador();
            if(jogador==this.jogador.getTime().getJogador2()){
                jogada2.setIcon(new ImageIcon(imgFolder+((AlertaJogada)o1).getJogada().getCartaJogada().imageURL()));
                switch(i++){
                    case 0:
                        carta11.setVisible(false);
                        break;
                    case 1:
                        carta12.setVisible(false);
                        break;
                    case 2:
                        carta13.setVisible(false);
                        break;
                    case 3:
                        carta14.setVisible(false);
                        break;
                    case 4:
                        carta15.setVisible(false);
                        break;
                    case 5:
                        carta16.setVisible(false);
                        break;
                    case 6:
                        carta17.setVisible(false);
                        break;
                    case 7:
                        carta18.setVisible(false);
                        break;
                    case 8:
                        carta19.setVisible(false);
                        break;
                    case 9:
                        carta20.setVisible(false);
                        break;
                }
                
            }else if(jogador==this.jogador){
                jogada1.setIcon(new ImageIcon(imgFolder+((AlertaJogada)o1).getJogada().getCartaJogada().imageURL()));
            }else if(jogador==this.jogo.getTimeB().getJogador1()){
                jogada3.setIcon(new ImageIcon(imgFolder+((AlertaJogada)o1).getJogada().getCartaJogada().imageURL()));
                switch(j++){
                    case 0:
                        carta21.setVisible(false);
                        break;
                    case 1:
                        carta22.setVisible(false);
                        break;
                    case 2:
                        carta23.setVisible(false);
                        break;
                    case 3:
                        carta24.setVisible(false);
                        break;
                    case 4:
                        carta25.setVisible(false);
                        break;
                    case 5:
                        carta26.setVisible(false);
                        break;
                    case 6:
                        carta27.setVisible(false);
                        break;
                    case 7:
                        carta28.setVisible(false);
                        break;
                    case 8:
                        carta29.setVisible(false);
                        break;
                    case 9:
                        carta30.setVisible(false);
                        break;
                }
            }else{
                jogada4.setIcon(new ImageIcon(imgFolder+((AlertaJogada)o1).getJogada().getCartaJogada().imageURL()));
                switch(k++){
                    case 0:
                        carta31.setVisible(false);
                        break;
                    case 1:
                        carta32.setVisible(false);
                        break;
                    case 2:
                        carta33.setVisible(false);
                        break;
                    case 3:
                        carta34.setVisible(false);
                        break;
                    case 4:
                        carta35.setVisible(false);
                        break;
                    case 5:
                        carta36.setVisible(false);
                        break;
                    case 6:
                        carta37.setVisible(false);
                        break;
                    case 7:
                        carta38.setVisible(false);
                        break;
                    case 8:
                        carta39.setVisible(false);
                        break;
                    case 9:
                        carta40.setVisible(false);
                        break;
                }
            }
            //jogada1 = new JButton(new ImageIcon(imgFolder+jogo.getTrunfo().imageURL()));
            
            if(((AlertaJogada)o1).getJogada().getJogador()==this.jogador){
                int cartaJogada=-1;
                for(int i=0;i<cartas.size();i++)
                    if(cartas.get(i).getNipe()==(((AlertaJogada)o1).getJogada().getCartaJogada()).getNipe()
                    && cartas.get(i).getNumero()==(((AlertaJogada)o1).getJogada().getCartaJogada()).getNumero()){
                        cartaJogada=i;
                        break;
                    }
                
                switch(cartaJogada){
                    case 0:
                        carta1.setVisible(false);
                        break;
                    case 1:
                        carta2.setVisible(false);
                        break;
                    case 2:
                        carta3.setVisible(false);
                        break;
                    case 3:
                        carta4.setVisible(false);
                        break;
                    case 4:
                        carta5.setVisible(false);
                        break;
                    case 5:
                        carta6.setVisible(false);
                        break;
                    case 6:
                        carta7.setVisible(false);
                        break;
                    case 7:
                        carta8.setVisible(false);
                        break;
                    case 8:
                        carta9.setVisible(false);
                        break;
                    case 9:
                        carta10.setVisible(false);
                        break;
                }
            }


            pack();
        }else if (o instanceof Rodada && o1 instanceof FimRodada){
            System.out.println("Rodada Final: "+countRodada);
            if(countRodada>=10){
                if(jogo.getTimeA().getPontos()>jogo.getTimeB().getPontos()){
                    jLabel2.setVisible(true);
                    vez.setText("Vencedores: ("+jogo.getTimeA().getPontos()+" pts) "+jogo.getTimeA().getJogador1().getNome()+", "+jogo.getTimeA().getJogador2().getNome());
                    vez1.setText("X ("+jogo.getTimeB().getPontos()+" pts) "+jogo.getTimeB().getJogador1().getNome()+", "+jogo.getTimeB().getJogador2().getNome());
                }else if(jogo.getTimeA().getPontos() < jogo.getTimeB().getPontos()){
                    jLabel1.setVisible(true);
                    vez.setText("Vencedores: ("+jogo.getTimeB().getPontos()+" pts) "+jogo.getTimeB().getJogador1().getNome()+", "+jogo.getTimeB().getJogador2().getNome());
                    vez1.setText("X ("+jogo.getTimeA().getPontos()+" pts) "+jogo.getTimeA().getJogador1().getNome()+", "+jogo.getTimeA().getJogador2().getNome());
                }else if(jogo.getTimeA().getPontos() == jogo.getTimeB().getPontos()){
                        vez.setText("Empate ("+jogo.getTimeA().getPontos()+" pts)!");
                }
                jogada1.setVisible(false);
                jogada2.setVisible(false);
                jogada3.setVisible(false);
                jogada4.setVisible(false);
                jButton1.setVisible(true);
            }
        }       
    }
}

